home *** CD-ROM | disk | FTP | other *** search
- #include <basepage.h>
- /* As supplied in MAST-DOM-DEC'86
-
- GETENV.C
-
- Keywords: ENVIRONMENT VARIABLE SHELL MARK WILLIAMS DOS C-SHELL GETENV
-
-
- getenv is a small C routine that solves the incompatibility
- problems between Mark Williams' and David Beckemeyer's environment block
- formats. Compile it into your program and it will be used instead of the
- library function. Arguments and return values are the same.
-
- */
-
- char *getenv(S) char *S;
- {
- char *T, *U;
- BASEPAGE *P;
- P=BP;
- T=(char *)(P->p_env);
- while ((*T)!=0)
- {
- U=S;
- while((*T)==(*U))
- {
- T++;
- U++;
- }
- if ((*T)=='='&&(*U)==0)
- {
- if (*(++T)==0)
- T++;
- return T;
- }
- if ((*T)!=0)
- {
- while ((*(T++))!=0);
- }
- else
- T++;
- }
- return NULL;
- }
-